Skip to content

fix: Exclude VMSS Flex with Standalone VMs and cleanup old workflow#721

Merged
oZakari merged 6 commits into
Azure:mainfrom
DaFitRobsta:40454---VMSS-Autoscale
May 1, 2025
Merged

fix: Exclude VMSS Flex with Standalone VMs and cleanup old workflow#721
oZakari merged 6 commits into
Azure:mainfrom
DaFitRobsta:40454---VMSS-Autoscale

Conversation

@DaFitRobsta
Copy link
Copy Markdown
Contributor

@DaFitRobsta DaFitRobsta commented Apr 22, 2025

Overview/Summary

The original KQL didn't account for VMSS flex instances that had standalone VMs associated with them. The updated query doesn't include a VMSS instance if the SKU is empty on the object.

Screenshot: Still returns VMSS instances without an empty SKU
image

Screenshot: Environment with VMSS instances with empty SKU:
image

Related Issues/Work Items

Fixes AB#40454

Also, have removed old and unused workflow for building recommendation object.

Breaking Changes

  1. No Breaking Changes.

As part of this pull request I have

  • Read the Contribution Guide and ensured this PR is compliant with the guide
  • Checked for duplicate Pull Requests
  • Associated it with relevant GitHub Issues or ADO Work Items (Internal Only)
  • Ensured my code/branch is up-to-date with the latest changes in the main branch
  • Ensured PR tests are passing
  • Performed testing and provided evidence (e.g. screenshot of output) for any changes associated to ARG queries
  • Updated relevant and associated documentation (e.g. Contribution Guide, Docs etc.)

Copilot AI review requested due to automatic review settings April 22, 2025 22:27
@DaFitRobsta DaFitRobsta requested a review from a team as a code owner April 22, 2025 22:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to fix the filter condition for VMSS Flex instances by excluding those with an empty SKU field.

  • Added a filtering condition to exclude instances without a SKU
  • Ensured that VMSS Flex instances with standalone VMs are filtered out

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Bug 🐞 Something isn't working label Apr 22, 2025
@DaFitRobsta DaFitRobsta requested a review from judyer28 April 22, 2025 22:28
Copy link
Copy Markdown
Contributor Author

@DaFitRobsta DaFitRobsta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Contributor

@judyer28 judyer28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kpoineal kpoineal enabled auto-merge (squash) April 29, 2025 14:40
@kpoineal
Copy link
Copy Markdown
Contributor

@tksh164 I'm seeing that Code scanning is waiting for results from CodeQL for the commits d7ad3a1 and b657fe5.

When I look at your commit from here: b657fe5

It's showing that it originated outside the repo... I'm not sure if Github is having an issue, but we can't merge this until the commit is "scanned". Have you run into this before?

@tksh164
Copy link
Copy Markdown
Member

tksh164 commented Apr 30, 2025

@kpoineal - It seems waiting to review from aprl-maintainers.

image

image

@tksh164 tksh164 requested a review from a team April 30, 2025 01:22
@kpoineal
Copy link
Copy Markdown
Contributor

@tksh164
This isn't happening because of the Validate ARG Queries job. See this screenshot:
image

All the checks have passed and I have approved the PR. Something is preventing the CodeQL from running correctly.

@tksh164
Copy link
Copy Markdown
Member

tksh164 commented May 1, 2025

@DaFitRobsta In currently, this PR blocked by waiting for results from CodeQL for the commits 332dacc or 5340e84.

5340e84 does not belong to this repo (APRLv2). It belongs to your forked repo.

I'm not sure, but I'm guessing that CodeQL does not enabled on your forked repo. It is the reason for the block on this PR, I think. So, could you try to check the code scanning settings on your forked repo?

image

image

@DaFitRobsta
Copy link
Copy Markdown
Contributor Author

I've enabled the default setup for CodeQL in my fork. I've made a minor change to the KQL file to start the review checks again. Please review @tksh164 and @kpoineal

@oZakari oZakari disabled auto-merge May 1, 2025 16:33
@oZakari oZakari closed this May 1, 2025
@oZakari oZakari reopened this May 1, 2025
@oZakari oZakari changed the title fix: Exclude VMSS Flex with Standalone VMs fix: Exclude VMSS Flex with Standalone VMs and cleanup old workflow May 1, 2025
@oZakari oZakari requested review from judyer28, kpoineal and tksh164 May 1, 2025 16:50
@oZakari oZakari requested a review from Copilot May 1, 2025 16:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the KQL query to exclude VMSS Flex instances associated with standalone VMs by filtering out entries with an empty SKU and removes an outdated workflow.

  • Changed the filter to only include entries with a non-empty SKU
  • Updated the inline comment to reflect the new exclusion criteria
Files not reviewed (2)
  • .github/scripts/build-recommendation-object.ps1: Language not supported
  • .github/workflows/build-recommendation-object.yml: Language not supported

// Find VMSS instances (excluding VMSS Flex associated with standalone VMs) associated with autoscale settings when autoscale is disabled
resources
| where type == "microsoft.compute/virtualmachinescalesets"
| where isempty(tostring(tags['aks-managed-poolName']))
Copy link

Copilot AI May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider adding a brief comment explaining why converting SKU to a string is required, to help future maintainers understand the data type assumptions in this query.

Suggested change
| where isempty(tostring(tags['aks-managed-poolName']))
| where isempty(tostring(tags['aks-managed-poolName']))
// Convert `sku` to a string to ensure consistent handling of its data type, as it might not always be a string.

Copilot uses AI. Check for mistakes.
@oZakari oZakari merged commit 5a8dbb1 into Azure:main May 1, 2025
9 checks passed
@DaFitRobsta DaFitRobsta deleted the 40454---VMSS-Autoscale branch May 1, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants